{include file="public/header" /}
<link rel="stylesheet" href="/static/admin/addons/builder/css/base.css" media="all">
<link rel="stylesheet" href="/static/admin/css/order.css" media="all">

<body>
<div class="layui-fluid layui-anim layui-anim-downbit">
    <div class="order_box">
        <div class="head">
            <div class="full">
                <img style="width: 50px;" src="/static/admin/images/order/order-icon.png"/>
                <div class="text">
                    <div class="title">商城订单</div>
                    <div>订单编号：{$info.sn}</div>
                </div>
                <div>
                    {if $info.status == 2}
                    <button type="button" class="layui-btn layui-btn-sm layui-btn-normal" lay-on="deliver">发货</button>
                    {/if}
                    {if $info.status > 2 && $info.status < 4}
                    <button type="button" class="layui-btn layui-btn-sm layui-btn-normal" lay-on="deliver">
                        修改发货信息
                    </button>
                    {/if}
                </div>
            </div>
            <ul class="list">
                <li class="item">
                    <div class="title">订单状态</div>
                    <div class="value1"><span>{$info.statusText}</span></div>
                </li>
                <li class="item">
                    <div class="title">实际支付</div>
                    <div>
                        ¥{$info.real_amount}
                    </div>
                </li>
                <li class="item">
                    <div class="title">支付方式</div>
                    <div>{$info.pay_way}</div>
                </li>
                <li class="item">
                    <div class="title">支付时间</div>
                    <div>{$info.pay_time}</div>
                </li>
            </ul>
        </div>

        <div class="layui-tab ">
            <ul class="layui-tab-title">
                <li class="layui-this">订单信息</li>
                <li>商品信息</li>
                <!--                <li>订单记录</li>-->
                <li>发货信息</li>

            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <div class="tabs-tab-pane">
                        <div class="section">
                            <div class="title">用户信息</div>
                            <ul class="list">
                                <li class="item">
                                    <div>会员UID：</div>
                                    <div class="value">
                                        {$info.user.id}
                                    </div>
                                </li>
                                <li class="item">
                                    <div>会员编号：</div>
                                    <div class="value">
                                        {$info.user.code}
                                    </div>
                                </li>
                                <li class="item">
                                    <div>会员昵称：</div>
                                    <div class="value">
                                        {$info.user.nickname}
                                    </div>
                                </li>
                                <li class="item">
                                    <div>会员电话：</div>
                                    <div class="value">
                                        {$info.user.mobile}
                                    </div>
                                </li>
                            </ul>
                        </div>
                        <div class="section">
                            <div class="title">收货信息</div>
                            <ul class="list top">
                                <li class="item" style="margin-top: 0">
                                    <div class="value">
                                        收货人：{$info.receiver}
                                    </div>
                                </li>
                            </ul>
                            <ul class="list top">
                                <li class="mt10">
                                    <div class="value">
                                        收货电话：{$info.receiver_tel}
                                    </div>
                                </li>
                            </ul>
                            <ul class="list top">
                                <li class="mt10">
                                    <div class="value">
                                        收货地址：{$info.p.title} {$info.c.title} {$info.d.title}
                                        {$info.t?$info.t.title:''} {$info.address_details}
                                    </div>
                                </li>
                            </ul>
                        </div>

                        <div class="section">
                            <div class="title">订单信息</div>
                            <ul class="list">
                                <li class="item">
                                    <div>创建时间：</div>
                                    <div class="value">
                                        {$info.create_time}
                                    </div>
                                </li>
                                <li class="item">
                                    <div>商品总数：</div>
                                    <div class="value">
                                        <?php echo count($info->productsField);?>
                                    </div>
                                </li>
                                <li class="item">
                                    <div>商品总价：</div>
                                    <div class="value">
                                        {$info.total_amount}
                                    </div>
                                </li>

                                <!-- <li class="item">
                                    <div>支付运费：</div>
                                    <div class="value">
                                        {$info.freight}
                                    </div>
                                </li> -->
                                <li class="item">
                                    <div>支付时间：</div>
                                    <div class="value">
                                        {$info.pay_time}
                                    </div>
                                </li>
                                <li class="item">
                                    <div>支付方式：</div>
                                    <div class="value">
                                        {$info.pay_way}
                                    </div>
                                </li>
                            </ul>
                        </div>
                    </div>

                </div>
                <div class="layui-tab-item">
                    <table class="layui-table" lay-skin="line">
                        <thead style="background: rgb(247,247,247)">
                        <tr>
                            <th>商品名称</th>
                            <th>规格</th>
                            <th width="100">单价</th>
                            <th width="50">数量</th>
                            <th width="100">小计</th>
                        </tr>
                        </thead>
                        <tbody>
                        {foreach name="$info.productsField" item="v"}
                        <tr class="data_line">
                            <td style="display: flex;align-items: center">
                                <a href="{$v.icon}" target="_blank">
                                    <img src="{$v.icon}" style="width: 50px;margin-right: 10px;border-radius: 5px"/>
                                </a>
                                <span>{$v.title}</span>
                            </td>
                            <td>{$v.spec}</td>
                            <td>{$v.vip_price}</td>
                            <td>{$v.num}</td>
                            <td>{$v.vip_price * $v.num}</td>
                        </tr>
                        {/foreach}
                        </tbody>

                    </table>
                </div>
                <div class="layui-tab-item">
                    <div class="tabs-tab-pane">
                        <div class="section">
                            <div class="title">发货信息</div>
                            <ul class="list top">
                                <li class="item">
                                    <div>快递公司：</div>
                                    <div class="value">
                                        {$info.express?$info.express.title:'-'}
                                    </div>
                                </li>
                                <li class="item">
                                    <div>快递单号：</div>
                                    <div class="value">
                                        {$info.express_code?:'-'}
                                    </div>
                                </li>
                                <li class="item">
                                    <div>发货时间：</div>
                                    <div class="value">
                                        {$info.post_time?:'-'}
                                    </div>
                                </li>
                                <li class="item">
                                    <div>发货备注：</div>
                                    <div class="value">
                                        {$info.post_remark?:'-'}
                                    </div>
                                </li>
                            </ul>

                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>
</div>
</body>
{include file="public/footer" /}
<script>
    layui.use(['util', 'layer'], function () {
        var a = $, u = layui.util, ly = layui.layer,
            p_ly = parent.layui.layer,
            url = {
                deliver: '{:url("order/deliver")}'
            };

        function load(text = '加载中...') {
            return p_ly.msg('<div><i class="layui-icon layui-icon-loading-1 layui-anim layui-anim-rotate layui-anim-loop"></i> ' + text + '', {
                shade: 0.8,
                time: 99999
            });
        }

        u.on({
            deliver: function () {
                var height = a(window).height();
                var h = height < 720 ? '80%' : '720px';
                p_ly.open({
                    type: 2,
                    title: '订单发货',
                    shadeClose: true,
                    shade: 0.8,
                    area: ['1000px', h],
                    content: url.deliver + '?id={$info.id}',
                    btn: ['确认', '取消'],
                    btn2: function (index) {
                        p_ly.close(index);
                    },
                    btn1: function (index) {
                        var body = p_ly.getChildFrame('body', index);
                        var i = load();
                        a.post(url.deliver, body.find('.layui-form').serialize(), function (data) {
                            p_ly.close(i);
                            if (data.code === 1) {
                                p_ly.msg(data.msg, {time: 1000}, function () {
                                    p_ly.close(index);
                                    location.reload()
                                });
                            } else {
                                p_ly.msg(data.msg);
                            }
                        });
                        return false
                    },
                });
            },
        });
    })
</script>
</html>